#
# Makefile for building cutils module for Python2.6 under Linux
#

CC = gcc
PY_INCLUDE = /usr/include/python2.6/
PY_NP   = /usr/include/numpy/

# Check for Python version
PYTHON          := python
PYTHON_VER      := $(shell $(PYTHON) -c "import sys; print sys.version[:3]")

# Get header for Python
# e.g /usr/include/python2.6
PY_INCLUDE      := $(shell $(PYTHON) -c 'import numpy.distutils.system_info as si; print(" -I").join(si.numpy_info().get_include_dirs())')
# Get headers for numpy 
# e.g /usr/lib/pymodules/python2.6/numpy/core/include
NUMPY_INC       := $(shell $(PYTHON) -c 'import numpy.distutils.misc_util as mu; print " -I".join(mu.get_numpy_include_dirs())')


# LINK & COMPILE
install: cutils.c cutils.h
	gcc -c cutils.c $(PY_INCLUDE) -I $(PY_NP) -I $(NUMPY_INC)
	gcc -shared cutils.o -o _cutils.so

clean:
	rm _cutils.so cutils.o

